<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // dot 除换行符外的任意单个字符
        let str = `
            <ul>
                <li>
                    <a>《Java》</a>
                    <p>￥145.32</p>
                </li>
                <li>
                    <a>Vue</a>
                    <p>￥133.23</p>
                </li>
            </ul>
        `
        //const reg = /<li>\s+<a>(.*?)<\/a>\s+<p>(.*?)<\/p>/
        const reg = /<li>.*?<a>(.*?)<\/a>.*?<p>(.*?)<\/p>/gs
        let result
        while (result = reg.exec(str)) {
            console.log(result)
        }
        console.log(result)
    </script>
</body>
</html>